package cn.iocoder.yudao.module.wms.dal.mysql.otherin;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.wms.dal.dataobject.otherin.OtherInDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.wms.controller.admin.otherin.vo.*;

/**
 * 通用入库单 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface OtherInMapper extends BaseMapperX<OtherInDO> {

    default PageResult<OtherInDO> selectPage(OtherInPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<OtherInDO>()
                .eqIfPresent(OtherInDO::getDocId, reqVO.getDocId())
                .betweenIfPresent(OtherInDO::getDocDate, reqVO.getDocDate())
                .eqIfPresent(OtherInDO::getCode, reqVO.getCode())
                .betweenIfPresent(OtherInDO::getTransactionDate, reqVO.getTransactionDate())
                .eqIfPresent(OtherInDO::getOperateUser, reqVO.getOperateUser())
                .eqIfPresent(OtherInDO::getOperateDept, reqVO.getOperateDept())
                .betweenIfPresent(OtherInDO::getOperateDate, reqVO.getOperateDate())
                .eqIfPresent(OtherInDO::getApproveUser, reqVO.getApproveUser())
                .betweenIfPresent(OtherInDO::getApproveDate, reqVO.getApproveDate())
                .eqIfPresent(OtherInDO::getBusinessSumQty, reqVO.getBusinessSumQty())
                .eqIfPresent(OtherInDO::getCostSumAmt, reqVO.getCostSumAmt())
                .eqIfPresent(OtherInDO::getApproveStatus, reqVO.getApproveStatus())
                .eqIfPresent(OtherInDO::getAnnex, reqVO.getAnnex())
                .eqIfPresent(OtherInDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(OtherInDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(OtherInDO::getId));
    }

    default OtherInDO selectByCode(String code) {
        return selectOne(OtherInDO::getCode, code);
    }

}